<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
    <title>品牌信息管理</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">
        $(document).ready(function() {
            if($("#link").val()){
                $('#linkBody').show();
                $('#url').attr("checked", true);
            }
            $("#title").focus();
            $("#inputForm").validate({
                submitHandler: function(form){
                    if ($("#categoryId").val()==""){
                        $("#categoryName").focus();
                        top.$.jBox.tip('请选择归属栏目','warning');
                    }else if (CKEDITOR.instances.content.getData()=="" && $("#link").val().trim()==""){
                        top.$.jBox.tip('请填写正文','warning');
                    }else{
                        loading('正在提交，请稍等...');
                        form.submit();
                    }
                },
                errorContainer: "#messageBox",
                errorPlacement: function(error, element) {
                    $("#messageBox").text("输入有误，请先更正。");
                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
                        error.appendTo(element.parent().parent());
                    } else {
                        error.insertAfter(element);
                    }
                }
            });
        });
    </script>
</head>
<body>
<ul class="nav nav-tabs">
    <li><a href="${ctx}/cms/cmsBusiness/?category.id=${cmsBusiness.category.id}&user.id=${cmsBusiness.user.id}">商城信息列表</a></li>
    <%--<li class="active"><a href="<c:url value='${fns:getAdminPath()}/cms/article/form?id=${article.id}&category.id=${article.category.id}'><c:param name='category.name' value='${article.category.name}'/></c:url>">文章<shiro:hasPermission name="cms:article:edit">${not empty article.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="cms:article:edit">查看</shiro:lacksPermission></a></li>--%>
    <li class="active"><a href="<c:url value='${fns:getAdminPath()}/cms/cmsBusiness/form?id=${cmsBusiness.id}&category.id=${cmsBusiness.category.id}&user.id=${cmsBusiness.user.id}'><c:param name='category.name' value='${cmsBusiness.category.name}'/></c:url>">商城信息<shiro:hasPermission name="cms:cmsBusiness:edit">${not empty cmsBusiness.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="cms:cmsBusiness:edit">查看</shiro:lacksPermission></a></li>
</ul>
<br/>
<form:form id="inputForm" modelAttribute="cmsBusiness" action="${ctx}/cms/cmsBusiness/save" method="post" class="form-horizontal">
    <form:hidden path="id"/>
    <sys:message content="${message}"/>
    <div class="control-group">
        <label class="control-label">归属栏目:</label>
        <div class="controls">
            <sys:treeselect id="category" name="category.id" value="${cmsBusiness.category.id}" labelName="category.name" labelValue="${cmsBusiness.category.name}"
                            title="栏目" url="/cms/category/treeData" module="cmsBusiness" selectScopeModule="true" notAllowSelectRoot="false" notAllowSelectParent="true" cssClass="required"/>&nbsp;
                <span>
                    <input id="url" type="checkbox" onclick="if(this.checked){$('#linkBody').show()}else{$('#linkBody').hide()}$('#link').val()"><label for="url">外部链接</label>
                </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">商家名称:</label>
        <div class="controls">
            <form:input path="name" htmlEscape="false" maxlength="200" class="input-xxlarge measure-input required"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">权重:</label>
        <div class="controls">
            <form:input path="weight" htmlEscape="false" maxlength="200" class="input-mini required digits"/>&nbsp;
				<span>
					<input id="weightTop" type="checkbox" onclick="$('#weight').val(this.checked?'999':'0')"><label for="weightTop">置顶</label>
				</span>
            &nbsp;过期时间：
            <input id="weightDate" name="weightDate" type="text" readonly="readonly" maxlength="20" class="input-small Wdate"
                   value="<fmt:formatDate value="${cmsBusiness.weightDate}" pattern="yyyy-MM-dd"/>"
            onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
            <span class="help-inline">数值越大排序越靠前，过期时间可为空，过期后取消置顶。</span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">摘要:</label>
        <div class="controls">
            <form:textarea path="description" htmlEscape="false" rows="4" maxlength="200" class="input-xxlarge"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">缩略图：</label>
        <div class="controls">
            <form:hidden id="image" path="image" htmlEscape="false" maxlength="255" class="input-xlarge"/>
            <sys:ckfinder input="image" type="images" uploadPath="/cms/cmsBusiness" selectMultiple="false"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">价格:</label>
        <div class="controls">
            <form:input path="price" htmlEscape="false" maxlength="200" class="input-xlarge"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">介绍:</label>
        <div class="controls">
            <form:textarea id="introduce" htmlEscape="true" path="introduce" rows="4" maxlength="200" class="input-xxlarge"/>
            <sys:ckeditor replace="introduce" uploadPath="/cms/cmsBusiness" />
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">店面地址地址:</label>
        <div class="controls">
            <form:input path="address" htmlEscape="false" maxlength="200" class="input-xlarge"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">电话:</label>
        <div class="controls">
            <form:input path="phone" htmlEscape="false" maxlength="200" class="input-xlarge"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">手机:</label>
        <div class="controls">
            <form:input path="mobile" htmlEscape="false" maxlength="200" class="input-xlarge"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">推荐位:</label>
        <div class="controls">
            <form:checkboxes path="posid" items="${fns:getDictList('cms_posid')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">备注:</label>
        <div class="controls">
            <form:input path="remarks" htmlEscape="false" maxlength="200" class="input-xlarge"/>
        </div>
    </div>

    <div class="control-group">
        <label class="control-label">图集：</label>
        <div class="controls">
            <form:hidden id="images" path="images" htmlEscape="false" maxlength="255" class="input-xlarge"/>
            <sys:ckfinder input="images" type="images" uploadPath="/cms/cmsBusiness" selectMultiple="true"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="form-actions">
        <shiro:hasPermission name="cms:cmsBusiness:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
    </div>
</form:form>
</body>
</html>